![]() |
PATH![]() |
Every Java program that needs access to the Abstract Window Toolkit (AWT) must have an AWT context associated with it. This AWT context supplies an execution environment for the Java program and an associated thread group. The following functions let you create or remove an AWT context or manipulate elements associated with the context.
OSStatus JMNewAWTContext (
JMAWTContextRef* context,
JMSessionRef session,
const JMAWTContextCallbacks* callbacks,
JMClientData data);
The
JMNewAWTContextInPage
function.
The
JMDisposeAWTContext
function.
OSStatus JMDisposeAWTContext (JMAWTContextRef context);
A successful call to the JMDisposeAWTContext function also removes any frames associated with the AWT context.
The
JMNewAWTContext
function.
Receives client-specific data associated with an AWT context.
OSStatus JMGetAWTContextData (
JMAWTContextRef context,
JMClientData* data);
JMSetAWTContextData
function.
Assigns client-specific data to an AWT context.
OSStatus JMSetAWTContextData (
JMAWTContextRef context,
JMClientData data);
JMGetAWTContextData
functionCounts the number of frames associated with an AWT context.
OSStatus JMCountAWTContextFrames (
JMAWTContextRef context,
UInt32* frameCount);
After determining the number of frames, you can then access an individual frame by calling The
JMGetAWTContextFrame
function.
Gets a particular frame associated with an AWT context.
OSStatus JMGetAWTContextFrame (
JMAWTContextRef context,
UInt32 frameIndex,
JMFrameRef* frame);
The index numbers for frames range from 0 to
frameCount
-1 (as determined by the
JMCountAWTContextFrames
function
JMCountAWTContextFrames
), with the most recently added frame having the highest number. The index number of a particular frame is not necessarily constant; removing or adding frames can cause the index number to change.
Dispatch a menu event to an AWT context.
OSStatus JMMenuSelected (
JMAWTContextRef context,
MenuHandle hMenu,
short menuItem);
You can use the Mac OS Toolbox function GetMenuHandle to get the appropriate value of the hMenu parameter to pass.
Dispatch a menu event to an AWT context.
OSStatus JMMenuSelectedWithModifiers(
JMAWTContextRef context,
MenuHandle hMenu,
short menuItem,
short modifiers);
You can use the Mac OS Toolbox function GetMenuHandle to get the appropriate value of the hMenu parameter to pass.
Executes a nonstatic Java method in a given AWT context thread using the Java Native Interface (JNI).
OSStatus JMExecJNIMethodInContext (
JMAWTContextRef context,
JNIEnv* env,
jobject objref,
jmethodID methodID,
UInt32 argCount,
jvalue args[]);
Before calling this function, you must call the
JMGetCurrentEnv
function
JMGetCurrentEnv
to get the
JNIEnv
pointer.
If you want to execute a static Java method (that is, one that is not local to an object) using the JNI, you must call the
JMExecJNIStaticMethodInContext
function
JMExecStaticMethodInContext
instead.
You can find documentation on the Java Native Interface (JNI) at the Web page
Executes a static Java method in a given AWT context thread using the Java Native Interface (JNI).
OSStatus JMExecJNIStaticMethodInContext (
JMAWTContextRef context,
JNIEnv* env,
jclass classID,
jmethodID methodID,
UInt32 argCount,
jvalue args[]);
Before calling this function, you must call the
JMGetCurrentEnv
function
JMGetCurrentEnv
to get the
JNIEnv
pointer.
For information about using this function to launch a Java application, see Executing Java Applications.
If you want to execute a nonstatic Java method, you should call the
JMExecJNIMethodInContext
function
JMExecJNIMethodInContext
instead.
You can find documentation on the Java Native Interface (JNI) at the Web page
Executes a nonstatic Java method in a given AWT context thread using the Java Runtime Interface (JRI).
OSStatus JMExecMethodInContext (
JMAWTContextRef context,
jref objref,
JRIMethodID methodID,
UInt32 argCount,
JRIValue args[]);
Unless you have a particular reason to access the Java Runtime Interface, you should instead make calls to the Java Native Interface, which provides similar functionality.
If you want to execute a static Java method (that is, one that is not local to an object) using the JRI, you must call the
JMExecStaticMethodInContext
function
JMExecStaticMethodInContext
instead.
You can find documentation on the Java Runtime Interface (JRI) at the Web page
The
JMExecJNIMethodInContext
function.
The
JMExecJNIStaticMethodInContext
function
JMExecStaticMethodInContext
.
Executes a static Java method in a given AWT context thread using the Java Runtime Interface (JRI).
OSStatus JMExecStaticMethodInContext (
JMAWTContextRef context,
JRIClassID classID,
JRIMethodID methodID,
UInt32 argCount,
JRIValue args[]);
Unless you have a particular reason to access the Java Runtime Interface, you should instead make calls to the Java Native Interface, which provides similar functionality.
If you want to execute a nonstatic Java method using the JRI, you should call the
JMExecMethodInContext
function
JMExecMethodInContext
instead.
You can find documentation on the Java Runtime Interface (JRI) at the Web page
The
JMExecJNIMethodInContext
function.
The
JMExecJNIStaticMethodInContext
function.
Returns a JNI reference to a context's Java object.
jobject JMGetAwtContextJNIObject (
JMAWTContextRef context,
JNIEnv * env);
This function returns the Java equivalent of the JMAWTContextRef reference.
Returns a JRI reference to a context's Java object.
jref JMGetAwtContextObject (JMAWTContextRef context);
This function returns the Java equivalent of the JMAWTContextRef reference.
Note that unless you specifically need to use the Java Runtime Interface (JRI), you should use the
JMGetAwtContextJNIObject
function instead.
Previous | Back Up One Level | Next |